//
//  TourDetailsController.m
//  GuideMe
//
//  Created by Amila Fonseka on 3/24/12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import "TourDetailsController.h"
#import "GuideViewController.h"
#import "CommentsViewController.h"
#import "MapViewController.h"

@implementation TourDetailsController

@synthesize strTourID, strTourTitle, strPurchasable;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}


- (IBAction)btnGuideTapped
{
    GuideViewController *guideView = [[GuideViewController alloc] initWithNibName:@"GuideViewController" bundle:nil];
    guideView.strCommingFrom = @"Guide";
    [self.navigationController pushViewController:guideView animated:YES];
    [guideView release];
}

- (IBAction)btnRoadMapTapped
{
    GuideViewController *guideView = [[GuideViewController alloc] initWithNibName:@"GuideViewController" bundle:nil];
    guideView.strCommingFrom = @"Places";
    [self.navigationController pushViewController:guideView animated:YES];
    [guideView release];
}

- (IBAction)btnUserCommentsTapped
{
    CommentsViewController *cView = [[CommentsViewController alloc] initWithNibName:@"CommentsViewController" bundle:nil];
    [self.navigationController pushViewController:cView animated:YES];
    [cView release];
}

- (IBAction)btnBackTapped
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (IBAction)btnMapTapped
{
    if (![strPurchasable isEqualToString:@"YES"])
    {
        MapViewController *cView = [[MapViewController alloc] initWithNibName:@"MapViewController" bundle:nil];
        [self.navigationController pushViewController:cView animated:YES];
        [cView release];
    }
    else
    {
        UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"Loading Error" message:@"Sorry, Map is paid Content." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [errorAlert show];
        [errorAlert release];
    }
}


- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    lblTourName.text = [NSString stringWithFormat:@"%@", strTourTitle];
    
    if ([strTourID isEqualToString:@"1"])
    {
        imgTour.image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"t1" ofType:@"png"]];
        
        txtTourDesciption.text = @"This could be consider as a family trip. The whole family will have a travel adventure when you take the kids or grandkids on one of the escorted family adventure tours by Classic Journeys. These fascinating itineraries satisfy the curiosity, energy levels and attention spans of multiple generations. We include activities for the whole family, plus chaperoned kids-only events, for unique family vacations you’ll all enjoy! Adventure travel is a type of tourism, involving exploration or travel to remote, exotic and possibly hostile areas. Adventure tourism is rapidly growing in popularity, as tourists seek different kinds of vacations. According to the U.S. based Adventure Travel Trade Association, adventure travel may be any tourist activity, including two of the following three components: a physical activity, a cultural exchange or interaction and engagement with nature. Adventure tourism gains much of its excitement by allowing its participants to step outside of their comfort zone. This may be from experiencing culture shock or through the performance of acts, that require significant effort and involve some degree of risk (real or perceived) and/or physical danger (See extreme sports). This may include activities such as mountaineering, trekking, bungee jumping, mountain biking, rafting, zip-lining and rock climbing. Some obscure forms of adventure travel include disaster and ghetto tourism. Other rising forms of adventure travel include social and jungle tourism.";
    }
    else if ([strTourID isEqualToString:@"2"])
    {
        imgTour.image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"t2" ofType:@"png"]];
        
        txtTourDesciption.text = @"Visiting historical places means visiting the places which are historically important.In this section we are consider about the ancient places which we could visit in a particular area.Then we arrange a trip.When we suggest a tour we consider about the all possible areas which the traveler could visit.This is ranking by the user preference.And not only that but also Sri Lanka is a country with a great historical culture.";
    }
    else if ([strTourID isEqualToString:@"3"])
    {
        imgTour.image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"t3" ofType:@"png"]];
        
        txtTourDesciption.text = @"In this tours we suggest tours which are giving enjoy, enthusiasm and also fun.The tourist could gain maximum from the tour and also could also gain knowledge.Mostof the times these tours are not only for fun but also tourist can gain knowledge  from this.Most of the ypung crowd like to ths and we mainly target this to them.";
    }
    else
    {
        imgTour.image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"t1" ofType:@"png"]];
    }
    
    btnGuide.hidden = YES;
    btnRoadMap.hidden = YES;
    btnPurchase.hidden = YES;
    
    if ([strPurchasable isEqualToString:@"YES"])
    {
        btnGuide.hidden = YES;
        btnRoadMap.hidden = YES;
        btnPurchase.hidden = NO;
    }
    else
    {
        btnGuide.hidden = NO;
        btnRoadMap.hidden = NO;
        btnPurchase.hidden = YES;
    }
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
